[Unit]
Description=Spark Slave service
Documentation=https://spark.apache.org/docs/latest/
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Type=forking
User={{ user }}
Group={{ user }}
Environment=SPARK_MASTER_HOST={{ masterIP }} SPARK_LOCAL_HOST={{ ansible_host }}
ExecStart={{ dir_spark }}/spark-bin/sbin/start-slave.sh {{ spark_masterurl }} -m {{ spark_worker_memory }}M
ExecStop={{ dir_spark }}/spark-bin/sbin/stop-slave.sh
Restart=on-failure
SyslogIdentifier=spark-slave

[Install]
WantedBy=multi-user.target